#include "EpilTableConstructorExpressionCode.h"
#include "EpilOutputHelper.h"
#include "TCharSupport.h"
#include "EpilPointerHelper.h"


EpilTableConstructorExpressionCode::EpilTableConstructorExpressionCode( const EpilLexLocation & location )
: EpilExpressionCodeBase( location )
{
}


EpilTableConstructorExpressionCode::~EpilTableConstructorExpressionCode()
{
	EpilPointerHelper::DeleteItemsAndClear( m_initializers );
}


tstring EpilTableConstructorExpressionCode::ToEpilCode( int indent ) const
{
	tstringstream ret;
	if( m_initializers.empty() )
	{
		ret << t("{}");
	}
	else
	{
		ret << t("{ ");
		ret << EpilOutputHelper::GetListOutput( m_initializers, t(", ") );
		ret << t(" }");
	}
	return ret.str();
}